<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class InitUpdate37 extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('package_skus', function (Blueprint $table) {
            $table->integer('package_asset_id')->nullable()->change(); 
            $table->integer('source_type')->default(1)->index()->comment('来源 1为开盒获得  2为转售获得'); 
        });

        Schema::table('resale_records', function (Blueprint $table) {

            $table->dropColumn(['pending_user_id']);
            $table->dropColumn(['complete_user_id']);
            $table->dropColumn(['pending_order_id']);
            $table->dropColumn(['complete_order_id']);

            $table->integer('buyer_id')->nullable()->index()->comment('买方id'); 
            $table->integer('order_id')->nullable()->index()->comment('订单id'); 
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('package_skus', function (Blueprint $table) {

            $table->dropColumn(['source_type']);
        });
    }
}
